/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package jlxy.ise.eroad.service.function;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author hcc25_000
 */
public class ClientFunc {

    public static String getAlpha(int flags) {
        int middleNum;
        char middleChar;
        String result = "";
        if (flags == 0) {
            middleChar = (char) ((int) (Math.random() * 24) + 65);
            result += middleChar;
        } else if (flags == 1) {
            middleChar = (char) ((int) (Math.random() * 24) + 97);
            result += middleChar;
        } else {
            middleNum = (int) (Math.random() * 10);
            result += middleNum;
        }
        return result;
    }

    public static String getCDKey() {
        String cdKey = "";
        int middleNum = 0;
        for (int i = 0; i < 8; i++) {
            middleNum = (int) (Math.random() * 3);
            switch (middleNum) {
                case 0:
                    cdKey += getAlpha(0);
                    break;
                case 1:
                    cdKey += getAlpha(1);
                    break;
                case 2:
                    cdKey += getAlpha(2);
                    break;
                default:
                    break;
            }
        }
        return cdKey;
    }
    
    public static String getCDKey1(){
        String cdkey="";
        int middleNum=0;
        for(int i=0;i<8;i++){
            middleNum=(int)(Math.random()*10);
            cdkey+=middleNum;
        }
        return cdkey;
    }
    /**
     * 
     * 
     * @return 返回下单时间 
     */
    public static String getTime(){
        Date date=new Date();
        DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
        
        return format.format(date);
    }
}
